package MineGod;

import java.util.ArrayList;

import org.newdawn.slick.opengl.Texture;

public class EmitterBlockBreak extends Emitter{

	
	private int numParticles = 3;
	private int maxLife = 500;
	private int life = 0;
	private Texture tex;
	
	public EmitterBlockBreak(double x, double y, Texture t) {
		super(x, y, 0, 1, 0, 1, 0, 1000, 1000);
		tex = t;
	}

	
	public void start(){
		for (int i = 0; i < numParticles; i++){
			double xs = (Chunk.rand.nextDouble()-.5)*.3;
			double ys = -(Chunk.rand.nextDouble()*.2);
			particles.add(new ParticleBlockBreak(particleLifeMin, xPos, yPos, xs, ys, tex));
		}
	}
	
	
	
	public void step(int delta){
		//Update particles:
		ArrayList<Particle> delList = new ArrayList<Particle>();
		for (Particle p : particles){
			p.update(delta);
			if (p.life <= 0){
				delList.add(p);
			}
		}
		//delete dead particles:
		for (Particle p : delList){
			particles.remove(p);
		}
		life += delta;
		if(life > maxLife){
			alive = false;
		}
	}
	
	
	
	
	
	
	
	
}
